// Java 객체를 JS 객체로 변환
function forJS(oObject) {

	// HashMap -> Object
	if (oObject instanceof java.util.HashMap) {

		var oDatas = {};
		var aKeys = oObject['keySet']().toArray();

		for (var nIndex in aKeys) {

			var sKey = aKeys[nIndex];
			var sVal = oObject.get(sKey);

			oDatas[sKey] = forJS(sVal);

		}

		return oDatas;

	// ArrayList -> Array
	} else if (oObject instanceof java.util.ArrayList) {

		var aDatas = [];

		for (var i = 0, len = oObject.size(); i < len; i++)
			aDatas.push(forJS(oObject.get(i)));

		return aDatas;

	// Double/Float/Integer -> Number
	} else if (oObject instanceof java.lang.Double || oObject instanceof java.lang.Float || oObject instanceof java.lang.Integer) {

		return parseFloat(oObject);

	// String -> String
	} else if (oObject instanceof java.lang.String) {

		return String(oObject);

	}

	return oObject;

}

//JS 객체를 Java 객체로 변환
function forJava(oObject) {

	// Array -> ArrayList
	if (oObject.constructor === Array) {

		var oArray = new java.util.ArrayList();

		for (var i = 0, len = oObject.length; i < len; i++)
			oArray.add(forJava(oObject[i]));

		return oArray;

	// Object -> HashMap
	} else if (oObject.constructor === Object) {

		var oHash = new java.util.HashMap();

		for (var sKey in oObject)
			oHash.put(sKey, forJava(oObject[sKey]));

		return oHash;

	}

	return oObject;

}